<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // try...catch... 语法将可能报错的代码包裹起来
    let str = '渣渣辉'
    try {
      str = '古天乐'
    } catch {
      console.log('为常量赋值的代码报错了！！！')
    }

    console.log(str)
  </script>
</body>
</html>